package demo6;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Demo {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext  context = new AnnotationConfigApplicationContext("demo6");
        /*
        Spring容器默认管理对象采取“单例模式”
        多次向容器获取对象时始终返回同一个对象
         */
        Person p1 = context.getBean(Person.class);
        Person p2 = context.getBean(Person.class);
        System.out.println(p1==p2);
    }
}
